﻿//Write an if statement that examines two integer variables and exchanges their values if the first one is greater than the second one.

using System;

class ExchangeTwoIntegerIfFirstGreater
{
    static void Main()
    {
        Console.Write("Enter first integer number: ");
        string firstIntegerString = Console.ReadLine();
        Console.Write("Enter second integer number: ");
        string secondIntegerString = Console.ReadLine();
        int firstNumber;
        int secondNumber;
        if (
            int.TryParse(firstIntegerString, out firstNumber) && 
            int.TryParse(secondIntegerString, out secondNumber)
            )
        {
            if (firstNumber > secondNumber)
            {
                int tempFirstNumber = firstNumber;
                firstNumber = secondNumber;
                secondNumber = tempFirstNumber;
            }
            Console.WriteLine("First integer number: {0}", firstNumber);
            Console.WriteLine("Second integer number: {0}", secondNumber);
        }
        else
        {
            Console.WriteLine("Not integer number !");
        }
    }
}
